﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Model
{
    public class T_AssetsObject
    {
        private System.Int32 db_OID;
        private System.String db_AssetsTitle;
        private System.DateTime db_PurchaseDate;
        private System.Int32 db_AssetsCategory;
        private System.Decimal db_PurchaseSum;
        private System.Decimal db_CurrentSum;
        private System.String db_Memo;

        public System.Int32 Db_OID
        {
            get { return db_OID; }
            set { db_OID = value; }
        }
        public System.String Db_AssetsTitle
        {
            get { return db_AssetsTitle; }
            set { db_AssetsTitle = value; }
        }
        public System.DateTime Db_PurchaseDate
        {
            get { return db_PurchaseDate; }
            set { db_PurchaseDate = value; }
        }
        public System.Int32 Db_AssetsCategory
        {
            get { return db_AssetsCategory; }
            set { db_AssetsCategory = value; }
        }
        public System.Decimal Db_PurchaseSum
        {
            get { return db_PurchaseSum; }
            set { db_PurchaseSum = value; }
        }
        public System.Decimal Db_CurrentSum
        {
            get { return db_CurrentSum; }
            set { db_CurrentSum = value; }
        }
        public System.String Db_Memo
        {
            get { return db_Memo; }
            set { db_Memo = value; }
        }

        public void Data2Object(DataRow value)
        {
            if (value["OID"] != DBNull.Value)
                db_OID = System.Int32.Parse(value["OID"].ToString());
            db_AssetsTitle = value["AssetsTitle"].ToString();
            if (value["PurchaseDate"] != DBNull.Value)
                db_PurchaseDate = System.DateTime.Parse(value["PurchaseDate"].ToString());
            if (value["AssetsCategory"] != DBNull.Value)
                db_AssetsCategory = System.Int32.Parse(value["AssetsCategory"].ToString());
            if (value["PurchaseSum"] != DBNull.Value)
                db_PurchaseSum = System.Decimal.Parse(value["PurchaseSum"].ToString());
            if (value["CurrentSum"] != DBNull.Value)
                db_CurrentSum = System.Decimal.Parse(value["CurrentSum"].ToString());
            db_Memo = value["Memo"].ToString();
        }

        public DataRow Object2Data(ref DataRow value)
        {
            value["OID"] = db_OID;
            value["AssetsTitle"] = db_AssetsTitle;
            value["PurchaseDate"] = db_PurchaseDate;
            value["AssetsCategory"] = db_AssetsCategory;
            value["PurchaseSum"] = db_PurchaseSum;
            value["CurrentSum"] = db_CurrentSum;
            value["Memo"] = db_Memo;
            return value;
        }
    } // end of class
}
